package com.sg.service.base.app.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sg.common.util.CommonFunctionHelper;
import com.sg.dto.base.app.req.*;
import com.sg.entity.OmsEvaObjTargetCycleWeightSet;
import com.sg.service.base.app.MOmsEvaObjTargetCycleWeightSetService;
import com.wicket.okrapp.common.dto.FieldInfo;
import com.wicket.okrapp.common.exception.BizException;
import com.wicket.okrapp.dal.mapper.mbg.OmsEvaObjTargetCycleWeightSetMapper;
import org.apache.skywalking.apm.toolkit.trace.Tag;
import org.apache.skywalking.apm.toolkit.trace.Tags;
import org.apache.skywalking.apm.toolkit.trace.Trace;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * @author ：
 * @version 1.0
 * @since 2022/1/19 15:39
 */
@Service
public class MOmsEvaObjTargetCycleWeightSetServiceImpl
        extends ServiceImpl<OmsEvaObjTargetCycleWeightSetMapper, OmsEvaObjTargetCycleWeightSet>
        implements MOmsEvaObjTargetCycleWeightSetService {

    @Autowired
    OmsEvaObjTargetCycleWeightSetMapper omsEvaObjTargetCycleWeightSetMapper;

    /**
     * 3-3-09-02查被评对象目标周期权重详情[2649]
     * gen by moon at 3/30/2023, 12:39:02 PM
     */
    @Trace(operationName = "3-3-09-02查被评对象目标周期权重详情")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    @Transactional(rollbackFor = Exception.class)
    public OmsEvaObjTargetCycleWeightSet queryEvaObjTargetCycleWeightDetail(QueryEvaObjTargetCycleWeightDetailReq reqDto) {

        try {
            reqDto.setIsValid("FALSE");
            reqDto.setSpaceId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecSpaceId());//CURRENT_SPACEID
            QueryWrapper<OmsEvaObjTargetCycleWeightSet> queryWrapper = new QueryWrapper<>();
            Map<String, Object> fieldInfoMap = null;
            fieldInfoMap = CommonFunctionHelper.objectToMapForLamBda(reqDto);
            CommonFunctionHelper.buildQueryWrapperEq(queryWrapper, fieldInfoMap, new ArrayList<>());
            queryWrapper.orderByDesc("create_time");
            List<OmsEvaObjTargetCycleWeightSet> retList = super.list(queryWrapper);
            if (retList != null && retList.size() > 0) {
                OmsEvaObjTargetCycleWeightSet retData = retList.get(0);

                return retData;
            }
            return null;
        } catch (Exception e) {
            e.printStackTrace();
            throw new BizException("-1", e, false);
        }
    }

    /**
     * 3-3-09-02批量查被评对象目标周期权重列表[2247]
     * gen by moon at 5/31/2023, 11:11:44 PM
     */
    @Trace(operationName = "3-3-09-02批量查被评对象目标周期权重列表")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    @Transactional(rollbackFor = Exception.class)
    public List<OmsEvaObjTargetCycleWeightSet> batchQueryEvaObjTargetCycleWeightList(BatchQueryEvaObjTargetCycleWeightListReq reqDto) {

        try {
            QueryWrapper<OmsEvaObjTargetCycleWeightSet> queryWrapper = new QueryWrapper<>();
            reqDto.setIsValid("FALSE");
            reqDto.setSpaceId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecSpaceId());//CURRENT_SPACEID
            reqDto.setAppId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecAppId());//CURRENT_APPID
            if (reqDto.getEvaObjTargetCycleWeightList() == null || reqDto.getEvaObjTargetCycleWeightList().isEmpty()) {
                return new ArrayList<>();
            }
            queryWrapper.in("eva_obj_target_cycle_id", reqDto.getEvaObjTargetCycleWeightList());
            Map<String, Object> fieldInfoMap = null;
            fieldInfoMap = CommonFunctionHelper.objectToMapForLamBda(reqDto);
            List<FieldInfo> compareList = CommonFunctionHelper.getRangeField(OmsEvaObjTargetCycleWeightSet.class);
            CommonFunctionHelper.buildQueryWrapperCompare(queryWrapper, compareList, fieldInfoMap);
            List<FieldInfo> likeList = CommonFunctionHelper.getLikeFiled(OmsEvaObjTargetCycleWeightSet.class);
            CommonFunctionHelper.buildQueryWrapperLike(queryWrapper, likeList, fieldInfoMap);
            likeList.addAll(compareList);
            CommonFunctionHelper.buildQueryWrapperEq(queryWrapper, fieldInfoMap, likeList);
            List<FieldInfo> orderList = CommonFunctionHelper.getOrderList(OmsEvaObjTargetCycleWeightSet.class);
            //CommonFunctionHelper.buildQueryWrapperOrder(queryWrapper, orderList);
            queryWrapper.orderByAsc("relative_order_number");
            queryWrapper.orderByDesc("order_number");
            queryWrapper.orderByDesc("operate_time");
            return ((List<OmsEvaObjTargetCycleWeightSet>) super.list(queryWrapper));
        } catch (Exception e) {
            e.printStackTrace();
            throw new BizException("-1", e, false);
        }
    }

    /**
     * 3-3-09-02批量增被评对象目标周期权重[2640]
     * gen by moon at 10/16/2022, 7:14:19 AM
     */
    @Trace(operationName = "3-3-09-02批量增被评对象目标周期权重")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    @Transactional(rollbackFor = Exception.class)
    public boolean batchAddEvaObjTargetCycleWeight(List<OmsEvaObjTargetCycleWeightSet> omsEvaObjTargetCycleWeightSet) {

        if (omsEvaObjTargetCycleWeightSet == null || omsEvaObjTargetCycleWeightSet.size() == 0) {
            return false;
        }

        return super.saveBatch(omsEvaObjTargetCycleWeightSet.stream().map(item -> {
            item.setObjTargetCycleWeightSetId(CommonFunctionHelper.getUid());//DISTRIBUTED_ID
            item.setBatchEndtTime(CommonFunctionHelper.getFutureTime());//FUTURE_CURRENT_TIME
            item.setIsUpdate("TRUE");
            item.setUpdateStatus("NEW");
            item.setArchivngType("NOT_ARCHIVE");
            item.setIsEditing("TRUE");
            item.setIsArchive("FALSE");
            item.setSubjectLifeCycle("EDITING");
            item.setOperationInductionId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecInductionRecordId());//CURRENT_INDUCTIONID
            item.setCreateInductionId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecInductionRecordId());//CURRENT_INDUCTIONID
            item.setOperateTime(CommonFunctionHelper.getCurrentTime());//SYSTEM_CURRENT_TIME
            item.setCreateTime(CommonFunctionHelper.getCurrentTime());//SYSTEM_CURRENT_TIME
            item.setIsValid("FALSE");
            item.setSpaceId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecSpaceId());//CURRENT_SPACEID
            item.setAppId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecAppId());//CURRENT_APPID
            return item;
        }).collect(Collectors.toList()));
    }

    /**
     * 3-3-09-02批量改被评对象目标周期权重[3676]
     * gen by moon at 1/5/2023, 3:33:05 AM
     */
    @Trace(operationName = "3-3-09-02批量改被评对象目标周期权重")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    @Transactional(rollbackFor = Exception.class)
    public boolean batchUpdateEvaObjTargetCycleWeight(List<OmsEvaObjTargetCycleWeightSet> omsEvaObjTargetCycleWeightSet) {

        if (omsEvaObjTargetCycleWeightSet == null || omsEvaObjTargetCycleWeightSet.size() == 0) {
            return false;
        }
        return super.saveOrUpdateBatch(omsEvaObjTargetCycleWeightSet);

    }

    /**
     * 3-3-09-02批量查询被评对象目标周期权重[2745]
     * gen by moon at 6/16/2024, 7:32:10 PM
     */
    @Trace(operationName = "3-3-09-02批量查询被评对象目标周期权重")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    @Transactional(rollbackFor = Exception.class)
    public List<OmsEvaObjTargetCycleWeightSet> batchQueryEvaObjTargetCycleWeight(BatchQueryEvaObjTargetCycleWeightReq reqDto) {

        try {
            QueryWrapper<OmsEvaObjTargetCycleWeightSet> queryWrapper = new QueryWrapper<>();
            reqDto.setIsValid("FALSE");
            reqDto.setSpaceId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecSpaceId());//CURRENT_SPACEID
            reqDto.setAppId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecAppId());//CURRENT_APPID
            if (reqDto.getEvaObjTargetCycleWeightList() == null || reqDto.getEvaObjTargetCycleWeightList().isEmpty()) {
                return new ArrayList<>();
            }
            queryWrapper.in("eva_obj_target_cycle_id", reqDto.getEvaObjTargetCycleWeightList());
            Map<String, Object> fieldInfoMap = null;
            fieldInfoMap = CommonFunctionHelper.objectToMapForLamBda(reqDto);
            List<FieldInfo> compareList = CommonFunctionHelper.getRangeField(OmsEvaObjTargetCycleWeightSet.class);
            CommonFunctionHelper.buildQueryWrapperCompare(queryWrapper, compareList, fieldInfoMap);
            List<FieldInfo> likeList = CommonFunctionHelper.getLikeFiled(OmsEvaObjTargetCycleWeightSet.class);
            CommonFunctionHelper.buildQueryWrapperLike(queryWrapper, likeList, fieldInfoMap);
            likeList.addAll(compareList);
            CommonFunctionHelper.buildQueryWrapperEq(queryWrapper, fieldInfoMap, likeList);
            List<FieldInfo> orderList = CommonFunctionHelper.getOrderList(OmsEvaObjTargetCycleWeightSet.class);
            //CommonFunctionHelper.buildQueryWrapperOrder(queryWrapper, orderList);
            queryWrapper.orderByAsc("relative_order_number");
            queryWrapper.orderByDesc("order_number");
            queryWrapper.orderByDesc("create_time");
            queryWrapper.orderByDesc("operate_time");
            return ((List<OmsEvaObjTargetCycleWeightSet>) super.list(queryWrapper));
        } catch (Exception e) {
            e.printStackTrace();
            throw new BizException("-1", e, false);
        }
    }

    /**
     * 3-3-09-02批量删被评对象目标周期权重[2746]
     * gen by moon at 10/16/2022, 7:14:22 AM
     */
    @Trace(operationName = "3-3-09-02批量删被评对象目标周期权重")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    @Transactional(rollbackFor = Exception.class)
    public boolean batchDeleteEvaObjTargetCycleWeight(List<String> reqDto) {

        if (reqDto == null || reqDto.size() == 0) {
            return false;
        }

        return super.removeByIds(reqDto);
    }

    /**
     * 3-3-09-02查询被评对象目标周期权重列表[2919]
     * gen by moon at 10/16/2022, 7:14:23 AM
     */
    @Trace(operationName = "3-3-09-02查询被评对象目标周期权重列表")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    @Transactional(rollbackFor = Exception.class)
    public List<OmsEvaObjTargetCycleWeightSet> queryEvaObjTargetCycleWeightList(QueryEvaObjTargetCycleWeightListReq reqDto) {

        try {
            QueryWrapper<OmsEvaObjTargetCycleWeightSet> queryWrapper = new QueryWrapper<>();
            reqDto.setIsValid("FALSE");
            reqDto.setSpaceId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecSpaceId());//CURRENT_SPACEID
            reqDto.setAppId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecAppId());//CURRENT_APPID

            Map<String, Object> fieldInfoMap = null;
            fieldInfoMap = CommonFunctionHelper.objectToMapForLamBda(reqDto);
            List<FieldInfo> compareList = CommonFunctionHelper.getRangeField(OmsEvaObjTargetCycleWeightSet.class);
            CommonFunctionHelper.buildQueryWrapperCompare(queryWrapper, compareList, fieldInfoMap);
            List<FieldInfo> likeList = CommonFunctionHelper.getLikeFiled(OmsEvaObjTargetCycleWeightSet.class);
            CommonFunctionHelper.buildQueryWrapperLike(queryWrapper, likeList, fieldInfoMap);
            likeList.addAll(compareList);
            CommonFunctionHelper.buildQueryWrapperEq(queryWrapper, fieldInfoMap, likeList);
            List<FieldInfo> orderList = CommonFunctionHelper.getOrderList(OmsEvaObjTargetCycleWeightSet.class);
            //CommonFunctionHelper.buildQueryWrapperOrder(queryWrapper, orderList);

            return ((List<OmsEvaObjTargetCycleWeightSet>) super.list(queryWrapper));
        } catch (Exception e) {
            e.printStackTrace();
            throw new BizException("-1", e, false);
        }
    }

    /**
     * M-构造被评对象目标周期权重设置验证数据[4248]
     * gen by moon at 10/16/2022, 7:14:24 AM
     */
    @Trace(operationName = "M-构造被评对象目标周期权重设置验证数据")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    @Transactional(rollbackFor = Exception.class)
    public String buildEvaObjTarCycWeiSet(OmsEvaObjTargetCycleWeightSet omsEvaObjTargetCycleWeightSet) {
        omsEvaObjTargetCycleWeightSet.setObjTargetCycleWeightSetId(CommonFunctionHelper.getUid());//DISTRIBUTED_ID
        omsEvaObjTargetCycleWeightSet.setOperationInductionId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecInductionRecordId());//CURRENT_INDUCTIONID
        omsEvaObjTargetCycleWeightSet.setCreateInductionId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecInductionRecordId());//CURRENT_INDUCTIONID
        if (omsEvaObjTargetCycleWeightSet != null && omsEvaObjTargetCycleWeightSet.getSubjectLifeCycle() != null && omsEvaObjTargetCycleWeightSet.getSubjectLifeCycle().equals("CURRENTLY_VALID")) {
            omsEvaObjTargetCycleWeightSet.setReleaseInductionId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecInductionRecordId());//RELEASED_CURRENT_INDUCTIONID
        }
        if (omsEvaObjTargetCycleWeightSet != null && omsEvaObjTargetCycleWeightSet.getSubjectLifeCycle() != null && omsEvaObjTargetCycleWeightSet.getSubjectLifeCycle().equals("ARCHIVING")) {
            omsEvaObjTargetCycleWeightSet.setArchiveInductionId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecInductionRecordId());//ARCHIVE_CURRENT_INDUCTIONID
        }
        omsEvaObjTargetCycleWeightSet.setOperateTime(CommonFunctionHelper.getCurrentTime());//SYSTEM_CURRENT_TIME
        omsEvaObjTargetCycleWeightSet.setCreateTime(CommonFunctionHelper.getCurrentTime());//SYSTEM_CURRENT_TIME
        if (omsEvaObjTargetCycleWeightSet != null && omsEvaObjTargetCycleWeightSet.getSubjectLifeCycle() != null && omsEvaObjTargetCycleWeightSet.getSubjectLifeCycle().equals("CURRENTLY_VALID")) {
            omsEvaObjTargetCycleWeightSet.setReleaseTime(CommonFunctionHelper.getCurrentTime());//RELEASE_SYSTEM_CURRENT_TIME
        }
        if (omsEvaObjTargetCycleWeightSet != null && omsEvaObjTargetCycleWeightSet.getSubjectLifeCycle() != null && omsEvaObjTargetCycleWeightSet.getSubjectLifeCycle().equals("ARCHIVING")) {
            omsEvaObjTargetCycleWeightSet.setArchiveTime(CommonFunctionHelper.getCurrentTime());//HISTORICAL_ARCHIVING
        }
        omsEvaObjTargetCycleWeightSet.setIsValid("FALSE");
        omsEvaObjTargetCycleWeightSet.setSpaceId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecSpaceId());//CURRENT_SPACEID
        omsEvaObjTargetCycleWeightSet.setAppId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecAppId());//CURRENT_APPID
        if (super.save(omsEvaObjTargetCycleWeightSet)) {
            return omsEvaObjTargetCycleWeightSet.getObjTargetCycleWeightSetId();
        } else {
            return "-1";
        }

    }

    /**
     * M3-3-09-02一键删除被评对象目标周期权重设置验证数据[4423]
     * gen by moon at 10/16/2022, 7:14:25 AM
     */
    @Trace(operationName = "M3-3-09-02一键删除被评对象目标周期权重设置验证数据")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    @Transactional(rollbackFor = Exception.class)
    public boolean autoDeleteEvaObjTarCycWeiSet(String objTargetCycleWeightSetId) {

        return super.removeById(objTargetCycleWeightSetId);
    }

    /**
     * M3-3-09-02查询被评对象目标周期权重设置列表测试[6255]
     * gen by moon at 4/9/2023, 10:40:09 PM
     */
    @Trace(operationName = "M3-3-09-02查询被评对象目标周期权重设置列表测试")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    @Transactional(rollbackFor = Exception.class)
    public List<OmsEvaObjTargetCycleWeightSet> queryEvaObjTarCycWeiSetList(QueryEvaObjTarCycWeiSetListReq reqDto) {

        try {
            QueryWrapper<OmsEvaObjTargetCycleWeightSet> queryWrapper = new QueryWrapper<>();


            Map<String, Object> fieldInfoMap = null;
            fieldInfoMap = CommonFunctionHelper.objectToMapForLamBda(reqDto);
            List<FieldInfo> compareList = CommonFunctionHelper.getRangeField(OmsEvaObjTargetCycleWeightSet.class);
            CommonFunctionHelper.buildQueryWrapperCompare(queryWrapper, compareList, fieldInfoMap);
            List<FieldInfo> likeList = CommonFunctionHelper.getLikeFiled(OmsEvaObjTargetCycleWeightSet.class);
            CommonFunctionHelper.buildQueryWrapperLike(queryWrapper, likeList, fieldInfoMap);
            likeList.addAll(compareList);
            CommonFunctionHelper.buildQueryWrapperEq(queryWrapper, fieldInfoMap, likeList);
            List<FieldInfo> orderList = CommonFunctionHelper.getOrderList(OmsEvaObjTargetCycleWeightSet.class);
            //CommonFunctionHelper.buildQueryWrapperOrder(queryWrapper, orderList);

            return ((List<OmsEvaObjTargetCycleWeightSet>) super.list(queryWrapper));
        } catch (Exception e) {
            e.printStackTrace();
            throw new BizException("-1", e, false);
        }
    }

    /**
     * 3-3-09-02删除被评对象目标周期权重[5083]
     * gen by moon at 11/1/2022, 7:52:24 AM
     */
    @Trace(operationName = "3-3-09-02删除被评对象目标周期权重")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    @Transactional(rollbackFor = Exception.class)
    public boolean deleteEvaObjTargetCycleWeight(String objTargetCycleWeightSetId) {

        return super.removeById(objTargetCycleWeightSetId);
    }

    /**
     * 3-3-09-02修改被评对象目标周期权重[5084]
     * gen by moon at 11/1/2022, 7:52:25 AM
     */
    @Trace(operationName = "3-3-09-02修改被评对象目标周期权重")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    @Transactional(rollbackFor = Exception.class)
    public boolean updateEvaObjTargetCycleWeight(OmsEvaObjTargetCycleWeightSet omsEvaObjTargetCycleWeightSet) {

        return super.updateById(omsEvaObjTargetCycleWeightSet);
    }

    /**
     * 3-3-09-02批量查询被评对象目标周期权重列表ByIds[5217]
     * gen by moon at 11/22/2022, 8:28:56 PM
     */
    @Trace(operationName = "3-3-09-02批量查询被评对象目标周期权重列表ByIds")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    @Transactional(rollbackFor = Exception.class)
    public List<OmsEvaObjTargetCycleWeightSet> batchQueryEvaObjTargetCycleWeightListByIds(BatchQueryEvaObjTargetCycleWeightListByIdsReq reqDto) {

        try {
            QueryWrapper<OmsEvaObjTargetCycleWeightSet> queryWrapper = new QueryWrapper<>();
            reqDto.setIsValid("FALSE");
            reqDto.setSpaceId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecSpaceId());//CURRENT_SPACEID
            if (reqDto.getEvaObjTargetCycleWeightList() == null || reqDto.getEvaObjTargetCycleWeightList().isEmpty()) {
                return new ArrayList<>();
            }
            queryWrapper.in("obj_target_cycle_weight_set_id", reqDto.getEvaObjTargetCycleWeightList());
            Map<String, Object> fieldInfoMap = null;
            fieldInfoMap = CommonFunctionHelper.objectToMapForLamBda(reqDto);
            List<FieldInfo> compareList = CommonFunctionHelper.getRangeField(OmsEvaObjTargetCycleWeightSet.class);
            CommonFunctionHelper.buildQueryWrapperCompare(queryWrapper, compareList, fieldInfoMap);
            List<FieldInfo> likeList = CommonFunctionHelper.getLikeFiled(OmsEvaObjTargetCycleWeightSet.class);
            CommonFunctionHelper.buildQueryWrapperLike(queryWrapper, likeList, fieldInfoMap);
            likeList.addAll(compareList);
            CommonFunctionHelper.buildQueryWrapperEq(queryWrapper, fieldInfoMap, likeList);
            List<FieldInfo> orderList = CommonFunctionHelper.getOrderList(OmsEvaObjTargetCycleWeightSet.class);
            //CommonFunctionHelper.buildQueryWrapperOrder(queryWrapper, orderList);

            return ((List<OmsEvaObjTargetCycleWeightSet>) super.list(queryWrapper));
        } catch (Exception e) {
            e.printStackTrace();
            throw new BizException("-1", e, false);
        }
    }

    /**
     * 3-3-09新增被评对象目标周期权重[5418]
     * gen by moon at 12/8/2022, 6:09:31 AM
     */
    @Trace(operationName = "3-3-09新增被评对象目标周期权重")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    @Transactional(rollbackFor = Exception.class)
    public String addEvaObjTargetCycleWeight(OmsEvaObjTargetCycleWeightSet omsEvaObjTargetCycleWeightSet) {
        omsEvaObjTargetCycleWeightSet.setObjTargetCycleWeightSetId(CommonFunctionHelper.getUid());//DISTRIBUTED_ID
        omsEvaObjTargetCycleWeightSet.setBatchEndtTime(CommonFunctionHelper.getFutureTime());//FUTURE_CURRENT_TIME
        omsEvaObjTargetCycleWeightSet.setIsUpdate("TRUE");
        omsEvaObjTargetCycleWeightSet.setUpdateStatus("NEW");
        omsEvaObjTargetCycleWeightSet.setArchivngType("NOT_ARCHIVE");
        omsEvaObjTargetCycleWeightSet.setIsEditing("TRUE");
        omsEvaObjTargetCycleWeightSet.setIsArchive("FALSE");
        omsEvaObjTargetCycleWeightSet.setSubjectLifeCycle("EDITING");
        omsEvaObjTargetCycleWeightSet.setOperationInductionId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecInductionRecordId());//CURRENT_INDUCTIONID
        omsEvaObjTargetCycleWeightSet.setCreateInductionId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecInductionRecordId());//CURRENT_INDUCTIONID
        omsEvaObjTargetCycleWeightSet.setOperateTime(CommonFunctionHelper.getCurrentTime());//SYSTEM_CURRENT_TIME
        omsEvaObjTargetCycleWeightSet.setCreateTime(CommonFunctionHelper.getCurrentTime());//SYSTEM_CURRENT_TIME
        omsEvaObjTargetCycleWeightSet.setIsValid("FALSE");
        omsEvaObjTargetCycleWeightSet.setSpaceId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecSpaceId());//CURRENT_SPACEID
        omsEvaObjTargetCycleWeightSet.setAppId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecAppId());//CURRENT_APPID
        if (super.save(omsEvaObjTargetCycleWeightSet)) {
            return omsEvaObjTargetCycleWeightSet.getObjTargetCycleWeightSetId();
        } else {
            return "-1";
        }

    }

    /**
     * M3-3-09-02查询被评对象目标周期权重设置详情测试[4467]
     * gen by moon at 4/9/2023, 10:40:05 PM
     */
    @Trace(operationName = "M3-3-09-02查询被评对象目标周期权重设置详情测试")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    @Transactional(rollbackFor = Exception.class)
    public OmsEvaObjTargetCycleWeightSet queryEvaObjTarCycWeiSetDetail(QueryEvaObjTarCycWeiSetDetailReq reqDto) {

        try {

            QueryWrapper<OmsEvaObjTargetCycleWeightSet> queryWrapper = new QueryWrapper<>();
            Map<String, Object> fieldInfoMap = null;
            fieldInfoMap = CommonFunctionHelper.objectToMapForLamBda(reqDto);
            CommonFunctionHelper.buildQueryWrapperEq(queryWrapper, fieldInfoMap, new ArrayList<>());
            queryWrapper.orderByDesc("create_time");
            List<OmsEvaObjTargetCycleWeightSet> retList = super.list(queryWrapper);
            if (retList != null && retList.size() > 0) {
                OmsEvaObjTargetCycleWeightSet retData = retList.get(0);

                return retData;
            }
            return null;
        } catch (Exception e) {
            e.printStackTrace();
            throw new BizException("-1", e, false);
        }
    }
}
